const { getDatabase } = require('../scripts/database')

module.exports = (fastify, opts, done) => {
    fastify.get('/', async (req, reply) => {
        const database = await getDatabase()
        return reply.view('/src/pages/index.ejs', database)
    })

    fastify.get('/login', async (req, reply) => {
        const database = await getDatabase()
        return reply.view('/src/pages/login.ejs', database)
    })

    fastify.get('/setting', async (req, reply) => {
        const database = await getDatabase()
        return reply.view('/src/pages/setting.ejs', database)
    })

    done()
}
